package eddy.yang.wordpad;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JPopupMenu;

public class WordPadPaneAction implements MouseListener{
	JPopupMenu popupMenu;
	public WordPadPaneAction(JPopupMenu popupMenu) {
		this.popupMenu = popupMenu;
	}

	public void mousePressed(MouseEvent e) {
		maybeShowPopup(e);
	}
	
	 public void mouseReleased(MouseEvent e) {
		 maybeShowPopup(e);
	 }
	 
	 private void maybeShowPopup(MouseEvent e) {
       if (e.isPopupTrigger()) {
         popupMenu.show(e.getComponent(), e.getX(), e.getY());
       }
     }

	public void mouseClicked(MouseEvent e) {
	}

	public void mouseEntered(MouseEvent e) {
	}

	public void mouseExited(MouseEvent e) {
	}
}
